Skip to content

UI: File tab Backstage view (#174) - #331

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
vangel76:feat/file-backstage
Oct 11, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
vangel76:feat/file-backstage

Conversation

@vangel76

Copy link
Copy Markdown
Contributor

Fixes #174

What

The File tab used to open a five-item popup (New, Open, Save, Save As, Close). Excel's File tab opens the Backstage view: a full-window page that replaces the ribbon and sheet until you press Esc or click the back arrow. GridCraft now does the same.

crates/ui-egui/src/backstage.rs (new) draws a navigation column and the selected page below the title bar. The state is UI-only and never saved. Each action runs an existing command through app.run or opens an existing dialog:

Page Contents
Home New tiles (blank workbook + the three built-in samples, thumbnails drawn in code) and the 8 most recent workbooks
New Blank workbook + samples (file.new)
Open Browse… (existing open picker, native or web) + the full recent list
Info Title and location, Protect Workbook (review.protectWorkbook), sheet count, editable properties (file.properties, committed when a field loses focus)
Save Saves and returns to the sheet. A workbook without a file goes to Save As first, like Excel
Save As Browse… (desktop save dialog) or Download (.xlsx) (web) via the existing saveAs path
Print Print button (file.print, same as the existing Print… menu item), active sheets or entire workbook, fit to one page, Page Setup… link, and a page preview with page navigation. The preview draws each page's cells at print scale inside the sheet's margins, using file.printPreview pagination
Export Create PDF (file.exportPdf), CSV (file.exportCsv), Web Page (file.exportHtml). Desktop goes through the save picker (the extension is set to the chosen format). Web downloads the file
Close file.close (the unsaved-changes prompt is kept)
Options Display theme, interface language, show formula bar, AutoSave, workbook calculation mode, iterative calculation. These are only settings that already exist, applied right away through their existing commands

Commands:

  • file.options (new engine command; it was the one missing File command in the parity checklist). It returns {calculation: {mode, iterative, maxIterations, maxChange}} and pushes UiRequest::Dialog("options"), which the UI shows as the Options page. This is the same pattern file.open and file.saveAs use with empty params. It never changes the workbook. The catalog moves from 258 to 259 / 290 (cargo xtask parity).
  • ui.backstage {page?} (UI command, listed in engine.commands). page is one of home, new, open, info, saveAs, print, export, options, or close. ui.inspect reports the open page as backstage. ui.dialog {"name":"backstage","page":…} also works, so the snapshot example can render it with --dialog 'backstage={"page":"print"}'.

Design decisions (from the task brief):

  • Clicking the File tab opens the Backstage view on Home. The ribbon's tab and collapsed state are kept for when it closes.
  • Keyboard shortcuts and the macOS native menu are unchanged. Ribbon key tips are suspended while the view is open.
  • A cell still being edited is committed when File opens. If the draft can't be committed (validation), the view stays closed.
  • Recent workbooks are listed by path only. Nothing is stat'ed or read until the user picks one, so no hangs on network paths and no automatic reads of paths.
  • New icons (Back, NewFile, OpenFolder, Info, Print) are line art in icons.rs. Colours come from theme::Tokens: the navigation uses the accent in light mode and accent_soft in dark mode.
  • All new strings are in every catalog (ja in i18n.rs, zh, ko, ru, pt). "File" is translated too. Spanish has no interface catalog on main. The Options section labels use Options|… context keys because "General" already means the number format.

Tests

  • crates/ui-egui/tests/file_menu.rs was rewritten for the Backstage view:
    • File → New → Blank workbook creates a document and closes the view.
    • File → Open → Browse… calls the picker, and a cancelled pick stays on Open.
    • Esc returns to the sheet with the ribbon tab and collapsed state kept.
    • Save on an unsaved book goes to Save As. Download (.xlsx) twice and Export → CSV each include the committed cell draft.
    • Close keeps the unsaved prompt.
    • file.options opens Options, every page is reachable through ui.backstage, an unknown page is refused, and the back arrow closes the view.
  • backstage.rs unit tests: page ids round-trip, recent-path splitting.
  • Engine: file_options_reports_settings_and_asks_for_the_options_page (no workbook gives null; it reports the settings, pushes the Options request and doesn't change the workbook). every_command_survives_empty_params covers the new command.

Commands run (touched crates only):

cargo test -p gridcraft-ui-egui --lib --test file_menu --test system_theme --test keytips --test popup_dismissal
cargo test -p gridcraft-engine
cargo clippy -p gridcraft-ui-egui -p gridcraft-engine --all-targets -- -D warnings
cargo fmt -p gridcraft-ui-egui -p gridcraft-engine -- --check
cargo check --target wasm32-unknown-unknown -p gridcraft-web -p gridcraft-engine
cargo xtask parity
cargo xtask layers

Screenshots (our own offscreen snapshots, described)

I rendered these with cargo run -p gridcraft-ui-egui --example snapshot -- --sample sales --dialog 'backstage={"page":"<page>"}' out.png in light and dark, plus Japanese:

  • Home: green navigation column (Back, Home, New, Open | Info, Save, Save As, Print, Export, Close, with Options at the bottom), a large page title, four new-workbook tiles and "No recent workbooks yet."
  • Print (dark): settings column on the left. On the right is a white page showing the sales table at print scale, "Sales · B2:H32" and "Page 1 of 2" with arrows.
  • Options (dark), Info, Export (Japanese): these render correctly with the translated navigation.

Not done

Unverified assumptions

  • Layout and wording follow Excel's Backstage only from memory and public documentation. plan/excel/observed-ui.md wasn't available in this checkout, so spacing and colours are not compared against measurements.
  • The ja/zh/ko/ru/pt strings are my own translations and need a check by native speakers.

🤖 Generated with Claude Code

Clicking the File tab now opens a full-window Backstage view in place of the
ribbon, formula bar, grid and sheet tabs, like Excel's. Esc or the back arrow
return to the sheet. Pages: Home (new + recent), New (blank + samples), Open
(recent + Browse), Info (location, properties, Protect Workbook), Save, Save As,
Print (page preview, scope, fit to page, Page Setup), Export (PDF, CSV, web
page), Close and Options (theme, language, formula bar, AutoSave, calculation).
Every action runs an existing command or dialog.

Adds `file.options` (reports the workbook's calculation settings and asks the
interface for the Options page) and the UI command `ui.backstage {page}`.
Keyboard shortcuts and the macOS native menu are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit 29660e8 into storytold:main Oct 11, 2026
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 11, 2026
…after #295)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 11, 2026
…ngside them; theme test goes through Backstage Options (#318 after #331)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 11, 2026
… combo (#318 after #331)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echelon

echelon commented Oct 11, 2026

Copy link
Copy Markdown
Member

Merged — thank you for the contribution! (I fixed Backstage › Options to read the formula-bar setting from engine prefs, since #295 moved it, and added Spanish/German/Czech strings for the new pages.)

If you haven't already, come join us on the ArtCraft Discord: https://discord.gg/artcraft

arcanii added a commit to arcanii/DevCraft that referenced this pull request Oct 12, 2026
Upstream is at 3926d21. Since the last merge it took in two of the
fork's changes and built two more itself, so the fork stops carrying
all four and uses upstream's:

- The clear active cell (storytold#265) and the selection glide with
  View > Animations (storytold#266) were merged upstream. The fork's copies go:
  aniefork/selection.rs, the view.animations command, the hooks in
  grid.rs, control.rs, lib.rs and ribbon.rs.
- Upstream built its own File page (storytold#331), with Save As, Print and
  Options pages, and closed ours (storytold#337) as a duplicate.
  aniefork/backstage.rs and its hooks go.
- Upstream's File page has an Options page, and file.options opens it.
  The fork's Options dialog and its file.options command are retired.
  Its two own settings (the user name, Show the Developer tab) are now
  drawn on upstream's page through one hook, with the commands
  app.userName and developer.tab.

The five conflicts were all at the fork's hooks. Upstream's version of
each file was taken and the hooks the fork still needs were put back;
ROADMAP-aniefork.md lists them. The fork now differs from upstream in
nine of upstream's files, by about fifty lines, and in none of grid.rs.

After the merge the fork's own tests pass, and fmt, clippy, assets,
layers, wasm, keytips and parity pass. Three tests fail that upstream's
main fails by itself, in files the fork doesn't touch: two CSV tests in
the engine and the French catalog check in the UI crate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files overlay missing

3 participants